#ifndef tutorialBranchesSelection_h
#define tutorialBranchesSelection_h

#include "SelectionBase.hxx"

/* In this file there is an example of selection with several branches. The CopySteps method is also used to copy steps from tutorialSelection 
   to this selection. Four new steps are added on top of the tutorialSelection, one for each of the three branches defined:
    1. Only one TPC track
    2. Two TPC tracks
    3. More than two TPC tracks
    3. More than two TPC tracks with more than 65 nodes in the closest TPC to the vertex

   Two define a selection you need in this file:
   - If a specific box is needed (the AnaBoxB is not sufficient) define it first such that it known when the Selection is defined
   - Declare the selection inheriting from SelectionBase or another existing selection
   - Declare all steps needed by the selection
*/

//---- Define an specific box for this selection -------
class AnaBoxTutorial: public AnaBoxB{
  
public:
  AnaBoxTutorial(){
    nLongTPCTracks = 0;
  }
  
  virtual ~AnaBoxTutorial(){}
  
  // number of TPC tracks with more that 65 nodes
  int nLongTPCTracks;
};

//---- Define the class for the new selection, which should inherit from SelectionBase or from another existing selection -------
class tutorialBranchesSelection: public SelectionBase{
  
public:
  tutorialBranchesSelection(bool forceBreak=true);
  virtual ~tutorialBranchesSelection(){}
  
  //---- Implement four mandatory methods -----

  // In this method all steps are added to the selection
  void DefineSteps();

  // Create a proper instance of the box (AnaBoxB) to store all relevent information to be passed from one step to the next
  AnaBoxB* MakeBox() {return new AnaBoxTutorial();}

  // Fill the event summary information, which is needed by the fitters (BANFF, Mach3)
  bool FillEventSummary(const AnaBoxB& box, AnaEventB& event, Int_t allCutsPassed[]);

  // Return the appropriate sample type
  nd280Samples::SampleEnum GetSampleEnum(){return nd280Samples::kFGD1NuMuCC0Pi;}  
};


//---- Define all steps -------
class FillSummaryAction_tutorialBranches: public StepBase{
    public:
        using StepBase::Apply;
        bool Apply(const AnaEventB& event, AnaBoxB& box) const;  
        StepBase* MakeClone(){return new FillSummaryAction_tutorialBranches();}
};

class OneTPCTrackCut: public StepBase{  
    public:
        using StepBase::Apply;
        bool Apply(const AnaEventB& event, AnaBoxB& box) const;
        StepBase* MakeClone(){return new OneTPCTrackCut();}
};

class TwoTPCTracksCut: public StepBase{  
    public:
        using StepBase::Apply;
        bool Apply(const AnaEventB& event, AnaBoxB& box) const;
        StepBase* MakeClone(){return new TwoTPCTracksCut();}
};

class MoreThanTwoTPCTracksCut: public StepBase{  
    public:
        using StepBase::Apply;
        bool Apply(const AnaEventB& event, AnaBoxB& box) const;
        StepBase* MakeClone(){return new MoreThanTwoTPCTracksCut();}
};

class MoreThanTwoLongTPCTracksCut: public StepBase{  
    public:
        using StepBase::Apply;
        bool Apply(const AnaEventB& event, AnaBoxB& box) const;
        StepBase* MakeClone(){return new MoreThanTwoLongTPCTracksCut();}
};

class FindLongTPCTracks: public StepBase{
    public:
        using StepBase::Apply;
        bool Apply(const AnaEventB& event, AnaBoxB& box) const;  
        StepBase* MakeClone(){return new FindLongTPCTracks();}
};


#endif
